home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / tex / tex31 / texsrc.lzh / TEXSRC.LZH / tex13.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-28  |  23.1 KB  |  1,017 lines

  1. #define EXTERN extern
  2. #include "texd.h"
  3.  
  4. void normalparagraph ( ) 
  5. {normalparagraph_regmem 
  6.   if ( eqtb [ 6182 ] .cint != 0 ) 
  7.   eqworddefine ( 6182 , 0 ) ; 
  8.   if ( eqtb [ 6747 ] .cint != 0 ) 
  9.   eqworddefine ( 6747 , 0 ) ; 
  10.   if ( eqtb [ 6204 ] .cint != 1 ) 
  11.   eqworddefine ( 6204 , 1 ) ; 
  12.   if ( eqtb [ 4312 ] .hh .v.RH != 0 ) 
  13.   eqdefine ( 4312 , 118 , 0 ) ; 
  14. void zboxend ( boxcontext ) 
  15. integer boxcontext ; 
  16. {boxend_regmem 
  17.   halfword p  ; 
  18.   if ( boxcontext < 1073741824L ) 
  19.   {
  20.     if ( curbox != 0 ) 
  21.     {
  22.       mem [ curbox + 4 ] .cint = boxcontext ; 
  23.       if ( abs ( curlist .modefield ) == 1 ) 
  24.       {
  25.     appendtovlist ( curbox ) ; 
  26.     if ( adjusttail != 0 ) 
  27.     {
  28.       if ( memtop - 5 != adjusttail ) 
  29.       {
  30.         mem [ curlist .tailfield ] .hh .v.RH = mem [ memtop - 5 ] .hh 
  31.         .v.RH ; 
  32.         curlist .tailfield = adjusttail ; 
  33.       } 
  34.       adjusttail = 0 ; 
  35.     } 
  36.     if ( curlist .modefield > 0 ) 
  37.     buildpage () ; 
  38.       } 
  39.       else {
  40.       
  41.     if ( abs ( curlist .modefield ) == 102 ) 
  42.     curlist .auxfield .hh .v.LH = 1000 ; 
  43.     else {
  44.         
  45.       p = newnoad () ; 
  46.       mem [ p + 1 ] .hh .v.RH = 2 ; 
  47.       mem [ p + 1 ] .hh .v.LH = curbox ; 
  48.       curbox = p ; 
  49.     } 
  50.     mem [ curlist .tailfield ] .hh .v.RH = curbox ; 
  51.     curlist .tailfield = curbox ; 
  52.       } 
  53.     } 
  54.   } 
  55.   else if ( boxcontext < 1073742336L ) 
  56.   if ( boxcontext < 1073742080L ) 
  57.   eqdefine ( -1073737246L + boxcontext , 119 , curbox ) ; 
  58.   else geqdefine ( -1073737502L + boxcontext , 119 , curbox ) ; 
  59.   else if ( curbox != 0 ) 
  60.   if ( boxcontext > 1073742336L ) 
  61.   {
  62.     do {
  63.     getxtoken () ; 
  64.     } while ( ! ( ( curcmd != 10 ) && ( curcmd != 0 ) ) ) ; 
  65.     if ( ( ( curcmd == 26 ) && ( abs ( curlist .modefield ) != 1 ) ) || ( ( 
  66.     curcmd == 27 ) && ( abs ( curlist .modefield ) == 1 ) ) || ( ( curcmd == 
  67.     28 ) && ( abs ( curlist .modefield ) == 203 ) ) ) 
  68.     {
  69.       appendglue () ; 
  70.       mem [ curlist .tailfield ] .hh.b1 = boxcontext - ( 1073742237L ) ; 
  71.       mem [ curlist .tailfield + 1 ] .hh .v.RH = curbox ; 
  72.     } 
  73.     else {
  74.     
  75.       {
  76.     if ( interaction == 3 ) 
  77.     wakeupterminal () ; 
  78.     printnl ( 262 ) ; 
  79.     print ( 1059 ) ; 
  80.       } 
  81.       {
  82.     helpptr = 3 ; 
  83.     helpline [ 2 ] = 1060 ; 
  84.     helpline [ 1 ] = 1061 ; 
  85.     helpline [ 0 ] = 1062 ; 
  86.       } 
  87.       backerror () ; 
  88.       flushnodelist ( curbox ) ; 
  89.     } 
  90.   } 
  91.   else shipout ( curbox ) ; 
  92. void zbeginbox ( boxcontext ) 
  93. integer boxcontext ; 
  94. {/* 10 30 */ beginbox_regmem 
  95.   halfword p, q  ; 
  96.   quarterword m  ; 
  97.   halfword k  ; 
  98.   eightbits n  ; 
  99.   switch ( curchr ) 
  100.   {case 0 : 
  101.     {
  102.       scaneightbitint () ; 
  103.       curbox = eqtb [ 4578 + curval ] .hh .v.RH ; 
  104.       eqtb [ 4578 + curval ] .hh .v.RH = 0 ; 
  105.     } 
  106.     break ; 
  107.   case 1 : 
  108.     {
  109.       scaneightbitint () ; 
  110.       curbox = copynodelist ( eqtb [ 4578 + curval ] .hh .v.RH ) ; 
  111.     } 
  112.     break ; 
  113.   case 2 : 
  114.     {
  115.       curbox = 0 ; 
  116.       if ( abs ( curlist .modefield ) == 203 ) 
  117.       {
  118.     youcant () ; 
  119.     {
  120.       helpptr = 1 ; 
  121.       helpline [ 0 ] = 1063 ; 
  122.     } 
  123.     error () ; 
  124.       } 
  125.       else if ( ( curlist .modefield == 1 ) && ( curlist .headfield == curlist 
  126.       .tailfield ) ) 
  127.       {
  128.     youcant () ; 
  129.     {
  130.       helpptr = 2 ; 
  131.       helpline [ 1 ] = 1064 ; 
  132.       helpline [ 0 ] = 1065 ; 
  133.     } 
  134.     error () ; 
  135.       } 
  136.       else {
  137.       
  138.     if ( ! ( curlist .tailfield >= himemmin ) ) 
  139.     if ( ( mem [ curlist .tailfield ] .hh.b0 == 0 ) || ( mem [ curlist 
  140.     .tailfield ] .hh.b0 == 1 ) ) 
  141.     {
  142.       q = curlist .headfield ; 
  143.       do {
  144.           p = q ; 
  145.         if ( ! ( q >= himemmin ) ) 
  146.         if ( mem [ q ] .hh.b0 == 7 ) 
  147.         {
  148.           {register integer for_end; m = 1 ; for_end = mem [ q ] .hh.b1 
  149.           ; if ( m <= for_end) do 
  150.         p = mem [ p ] .hh .v.RH ; 
  151.           while ( m++ < for_end ) ; } 
  152.           if ( p == curlist .tailfield ) 
  153.           goto lab30 ; 
  154.         } 
  155.         q = mem [ p ] .hh .v.RH ; 
  156.       } while ( ! ( q == curlist .tailfield ) ) ; 
  157.       curbox = curlist .tailfield ; 
  158.       mem [ curbox + 4 ] .cint = 0 ; 
  159.       curlist .tailfield = p ; 
  160.       mem [ p ] .hh .v.RH = 0 ; 
  161.       lab30: ; 
  162.     } 
  163.       } 
  164.     } 
  165.     break ; 
  166.   case 3 : 
  167.     {
  168.       scaneightbitint () ; 
  169.       n = curval ; 
  170.       if ( ! scankeyword ( 835 ) ) 
  171.       {
  172.     {
  173.       if ( interaction == 3 ) 
  174.       wakeupterminal () ; 
  175.       printnl ( 262 ) ; 
  176.       print ( 1066 ) ; 
  177.     } 
  178.     {
  179.       helpptr = 2 ; 
  180.       helpline [ 1 ] = 1067 ; 
  181.       helpline [ 0 ] = 1068 ; 
  182.     } 
  183.     error () ; 
  184.       } 
  185.       scandimen ( false , false , false ) ; 
  186.       curbox = vsplit ( n , curval ) ; 
  187.     } 
  188.     break ; 
  189.     default: 
  190.     {
  191.       k = curchr - 4 ; 
  192.       savestack [ saveptr + 0 ] .cint = boxcontext ; 
  193.       if ( k == 102 ) 
  194.       if ( ( boxcontext < 1073741824L ) && ( abs ( curlist .modefield ) == 1 ) 
  195.       ) 
  196.       scanspec ( 3 , true ) ; 
  197.       else scanspec ( 2 , true ) ; 
  198.       else {
  199.       
  200.     if ( k == 1 ) 
  201.     scanspec ( 4 , true ) ; 
  202.     else {
  203.         
  204.       scanspec ( 5 , true ) ; 
  205.       k = 1 ; 
  206.     } 
  207.     normalparagraph () ; 
  208.       } 
  209.       pushnest () ; 
  210.       curlist .modefield = - (integer) k ; 
  211.       if ( k == 1 ) 
  212.       {
  213.     curlist .auxfield .cint = -65536000L ; 
  214.     if ( eqtb [ 4318 ] .hh .v.RH != 0 ) 
  215.     begintokenlist ( eqtb [ 4318 ] .hh .v.RH , 11 ) ; 
  216.       } 
  217.       else {
  218.       
  219.     curlist .auxfield .hh .v.LH = 1000 ; 
  220.     if ( eqtb [ 4317 ] .hh .v.RH != 0 ) 
  221.     begintokenlist ( eqtb [ 4317 ] .hh .v.RH , 10 ) ; 
  222.       } 
  223.       return ; 
  224.     } 
  225.     break ; 
  226.   } 
  227.   boxend ( boxcontext ) ; 
  228. void zscanbox ( boxcontext ) 
  229. integer boxcontext ; 
  230. {scanbox_regmem 
  231.   do {
  232.       getxtoken () ; 
  233.   } while ( ! ( ( curcmd != 10 ) && ( curcmd != 0 ) ) ) ; 
  234.   if ( curcmd == 20 ) 
  235.   beginbox ( boxcontext ) ; 
  236.   else if ( ( boxcontext >= 1073742337L ) && ( ( curcmd == 36 ) || ( curcmd == 
  237.   35 ) ) ) 
  238.   {
  239.     curbox = scanrulespec () ; 
  240.     boxend ( boxcontext ) ; 
  241.   } 
  242.   else {
  243.       
  244.     {
  245.       if ( interaction == 3 ) 
  246.       wakeupterminal () ; 
  247.       printnl ( 262 ) ; 
  248.       print ( 1069 ) ; 
  249.     } 
  250.     {
  251.       helpptr = 3 ; 
  252.       helpline [ 2 ] = 1070 ; 
  253.       helpline [ 1 ] = 1071 ; 
  254.       helpline [ 0 ] = 1072 ; 
  255.     } 
  256.     backerror () ; 
  257.   } 
  258. void zpackage ( c ) 
  259. smallnumber c ; 
  260. {package_regmem 
  261.   scaled h  ; 
  262.   halfword p  ; 
  263.   scaled d  ; 
  264.   d = eqtb [ 6737 ] .cint ; 
  265.   unsave () ; 
  266.   saveptr = saveptr - 3 ; 
  267.   if ( curlist .modefield == -102 ) 
  268.   curbox = hpack ( mem [ curlist .headfield ] .hh .v.RH , savestack [ saveptr 
  269.   + 2 ] .cint , savestack [ saveptr + 1 ] .cint ) ; 
  270.   else {
  271.       
  272.     curbox = vpackage ( mem [ curlist .headfield ] .hh .v.RH , savestack [ 
  273.     saveptr + 2 ] .cint , savestack [ saveptr + 1 ] .cint , d ) ; 
  274.     if ( c == 4 ) 
  275.     {
  276.       h = 0 ; 
  277.       p = mem [ curbox + 5 ] .hh .v.RH ; 
  278.       if ( p != 0 ) 
  279.       if ( mem [ p ] .hh.b0 <= 2 ) 
  280.       h = mem [ p + 3 ] .cint ; 
  281.       mem [ curbox + 2 ] .cint = mem [ curbox + 2 ] .cint - h + mem [ curbox + 
  282.       3 ] .cint ; 
  283.       mem [ curbox + 3 ] .cint = h ; 
  284.     } 
  285.   } 
  286.   popnest () ; 
  287.   boxend ( savestack [ saveptr + 0 ] .cint ) ; 
  288. smallnumber znormmin ( h ) 
  289. integer h ; 
  290. {register smallnumber Result; normmin_regmem 
  291.   if ( h <= 0 ) 
  292.   Result = 1 ; 
  293.   else if ( h >= 63 ) 
  294.   Result = 63 ; 
  295.   else Result = h ; 
  296.   return(Result) ; 
  297. void znewgraf ( indented ) 
  298. boolean indented ; 
  299. {newgraf_regmem 
  300.   curlist .pgfield = 0 ; 
  301.   if ( ( curlist .modefield == 1 ) || ( curlist .headfield != curlist 
  302.   .tailfield ) ) 
  303.   {
  304.     mem [ curlist .tailfield ] .hh .v.RH = newparamglue ( 2 ) ; 
  305.     curlist .tailfield = mem [ curlist .tailfield ] .hh .v.RH ; 
  306.   } 
  307.   curlist .lhmfield = normmin ( eqtb [ 6214 ] .cint ) ; 
  308.   curlist .rhmfield = normmin ( eqtb [ 6215 ] .cint ) ; 
  309.   pushnest () ; 
  310.   curlist .modefield = 102 ; 
  311.   curlist .auxfield .hh .v.LH = 1000 ; 
  312.   curlist .auxfield .hh .v.RH = 0 ; 
  313.   if ( indented ) 
  314.   {
  315.     curlist .tailfield = newnullbox () ; 
  316.     mem [ curlist .headfield ] .hh .v.RH = curlist .tailfield ; 
  317.     mem [ curlist .tailfield + 1 ] .cint = eqtb [ 6730 ] .cint ; 
  318.   } 
  319.   if ( eqtb [ 4314 ] .hh .v.RH != 0 ) 
  320.   begintokenlist ( eqtb [ 4314 ] .hh .v.RH , 7 ) ; 
  321.   if ( nestptr == 1 ) 
  322.   buildpage () ; 
  323. void indentinhmode ( ) 
  324. {indentinhmode_regmem 
  325.   halfword p, q  ; 
  326.   if ( curchr > 0 ) 
  327.   {
  328.     p = newnullbox () ; 
  329.     mem [ p + 1 ] .cint = eqtb [ 6730 ] .cint ; 
  330.     if ( abs ( curlist .modefield ) == 102 ) 
  331.     curlist .auxfield .hh .v.LH = 1000 ; 
  332.     else {
  333.     
  334.       q = newnoad () ; 
  335.       mem [ q + 1 ] .hh .v.RH = 2 ; 
  336.       mem [ q + 1 ] .hh .v.LH = p ; 
  337.       p = q ; 
  338.     } 
  339.     {
  340.       mem [ curlist .tailfield ] .hh .v.RH = p ; 
  341.       curlist .tailfield = mem [ curlist .tailfield ] .hh .v.RH ; 
  342.     } 
  343.   } 
  344. void headforvmode ( ) 
  345. {headforvmode_regmem 
  346.   if ( curlist .modefield < 0 ) 
  347.   if ( curcmd != 36 ) 
  348.   offsave () ; 
  349.   else {
  350.       
  351.     {
  352.       if ( interaction == 3 ) 
  353.       wakeupterminal () ; 
  354.       printnl ( 262 ) ; 
  355.       print ( 681 ) ; 
  356.     } 
  357.     printesc ( 517 ) ; 
  358.     print ( 1075 ) ; 
  359.     {
  360.       helpptr = 2 ; 
  361.       helpline [ 1 ] = 1076 ; 
  362.       helpline [ 0 ] = 1077 ; 
  363.     } 
  364.     error () ; 
  365.   } 
  366.   else {
  367.       
  368.     backinput () ; 
  369.     curtok = partoken ; 
  370.     backinput () ; 
  371.     curinput .indexfield = 4 ; 
  372.   } 
  373. void endgraf ( ) 
  374. {endgraf_regmem 
  375.   if ( curlist .modefield == 102 ) 
  376.   {
  377.     if ( curlist .headfield == curlist .tailfield ) 
  378.     popnest () ; 
  379.     else linebreak ( eqtb [ 6169 ] .cint ) ; 
  380.     normalparagraph () ; 
  381.     errorcount = 0 ; 
  382.   } 
  383. void begininsertoradjust ( ) 
  384. {begininsertoradjust_regmem 
  385.   if ( curcmd == 38 ) 
  386.   curval = 255 ; 
  387.   else {
  388.       
  389.     scaneightbitint () ; 
  390.     if ( curval == 255 ) 
  391.     {
  392.       {
  393.     if ( interaction == 3 ) 
  394.     wakeupterminal () ; 
  395.     printnl ( 262 ) ; 
  396.     print ( 1078 ) ; 
  397.       } 
  398.       printesc ( 327 ) ; 
  399.       printint ( 255 ) ; 
  400.       {
  401.     helpptr = 1 ; 
  402.     helpline [ 0 ] = 1079 ; 
  403.       } 
  404.       error () ; 
  405.       curval = 0 ; 
  406.     } 
  407.   } 
  408.   savestack [ saveptr + 0 ] .cint = curval ; 
  409.   incr ( saveptr ) ; 
  410.   newsavelevel ( 11 ) ; 
  411.   scanleftbrace () ; 
  412.   normalparagraph () ; 
  413.   pushnest () ; 
  414.   curlist .modefield = -1 ; 
  415.   curlist .auxfield .cint = -65536000L ; 
  416. void makemark ( ) 
  417. {makemark_regmem 
  418.   halfword p  ; 
  419.   p = scantoks ( false , true ) ; 
  420.   p = getnode ( 2 ) ; 
  421.   mem [ p ] .hh.b0 = 4 ; 
  422.   mem [ p ] .hh.b1 = 0 ; 
  423.   mem [ p + 1 ] .cint = defref ; 
  424.   mem [ curlist .tailfield ] .hh .v.RH = p ; 
  425.   curlist .tailfield = p ; 
  426. void appendpenalty ( ) 
  427. {appendpenalty_regmem 
  428.   scanint () ; 
  429.   {
  430.     mem [ curlist .tailfield ] .hh .v.RH = newpenalty ( curval ) ; 
  431.     curlist .tailfield = mem [ curlist .tailfield ] .hh .v.RH ; 
  432.   } 
  433.   if ( curlist .modefield == 1 ) 
  434.   buildpage () ; 
  435. void deletelast ( ) 
  436. {/* 10 */ deletelast_regmem 
  437.   halfword p, q  ; 
  438.   quarterword m  ; 
  439.   if ( ( curlist .modefield == 1 ) && ( curlist .tailfield == curlist 
  440.   .headfield ) ) 
  441.   {
  442.     if ( ( curchr != 10 ) || ( lastglue != 65535L ) ) 
  443.     {
  444.       youcant () ; 
  445.       {
  446.     helpptr = 2 ; 
  447.     helpline [ 1 ] = 1064 ; 
  448.     helpline [ 0 ] = 1080 ; 
  449.       } 
  450.       if ( curchr == 11 ) 
  451.       helpline [ 0 ] = ( 1081 ) ; 
  452.       else if ( curchr != 10 ) 
  453.       helpline [ 0 ] = ( 1082 ) ; 
  454.       error () ; 
  455.     } 
  456.   } 
  457.   else {
  458.       
  459.     if ( ! ( curlist .tailfield >= himemmin ) ) 
  460.     if ( mem [ curlist .tailfield ] .hh.b0 == curchr ) 
  461.     {
  462.       q = curlist .headfield ; 
  463.       do {
  464.       p = q ; 
  465.     if ( ! ( q >= himemmin ) ) 
  466.     if ( mem [ q ] .hh.b0 == 7 ) 
  467.     {
  468.       {register integer for_end; m = 1 ; for_end = mem [ q ] .hh.b1 
  469.       ; if ( m <= for_end) do 
  470.         p = mem [ p ] .hh .v.RH ; 
  471.       while ( m++ < for_end ) ; } 
  472.       if ( p == curlist .tailfield ) 
  473.       return ; 
  474.     } 
  475.     q = mem [ p ] .hh .v.RH ; 
  476.       } while ( ! ( q == curlist .tailfield ) ) ; 
  477.       mem [ p ] .hh .v.RH = 0 ; 
  478.       flushnodelist ( curlist .tailfield ) ; 
  479.       curlist .tailfield = p ; 
  480.     } 
  481.   } 
  482. void unpackage ( ) 
  483. {/* 10 */ unpackage_regmem 
  484.   halfword p  ; 
  485.   schar c  ; 
  486.   c = curchr ; 
  487.   scaneightbitint () ; 
  488.   p = eqtb [ 4578 + curval ] .hh .v.RH ; 
  489.   if ( p == 0 ) 
  490.   return ; 
  491.   if ( ( abs ( curlist .modefield ) == 203 ) || ( ( abs ( curlist .modefield ) 
  492.   == 1 ) && ( mem [ p ] .hh.b0 != 1 ) ) || ( ( abs ( curlist .modefield ) == 
  493.   102 ) && ( mem [ p ] .hh.b0 != 0 ) ) ) 
  494.   {
  495.     {
  496.       if ( interaction == 3 ) 
  497.       wakeupterminal () ; 
  498.       printnl ( 262 ) ; 
  499.       print ( 1090 ) ; 
  500.     } 
  501.     {
  502.       helpptr = 3 ; 
  503.       helpline [ 2 ] = 1091 ; 
  504.       helpline [ 1 ] = 1092 ; 
  505.       helpline [ 0 ] = 1093 ; 
  506.     } 
  507.     error () ; 
  508.     return ; 
  509.   } 
  510.   if ( c == 1 ) 
  511.   mem [ curlist .tailfield ] .hh .v.RH = copynodelist ( mem [ p + 5 ] .hh 
  512.   .v.RH ) ; 
  513.   else {
  514.       
  515.     mem [ curlist .tailfield ] .hh .v.RH = mem [ p + 5 ] .hh .v.RH ; 
  516.     eqtb [ 4578 + curval ] .hh .v.RH = 0 ; 
  517.     freenode ( p , 7 ) ; 
  518.   } 
  519.   while ( mem [ curlist .tailfield ] .hh .v.RH != 0 ) curlist .tailfield = mem 
  520.   [ curlist .tailfield ] .hh .v.RH ; 
  521. void appenditaliccorrection ( ) 
  522. {/* 10 */ appenditaliccorrection_regmem 
  523.   halfword p  ; 
  524.   internalfontnumber f  ; 
  525.   if ( curlist .tailfield != curlist .headfield ) 
  526.   {
  527.     if ( ( curlist .tailfield >= himemmin ) ) 
  528.     p = curlist .tailfield ; 
  529.     else if ( mem [ curlist .tailfield ] .hh.b0 == 6 ) 
  530.     p = curlist .tailfield + 1 ; 
  531.     else return ; 
  532.     f = mem [ p ] .hh.b0 ; 
  533.     {
  534.       mem [ curlist .tailfield ] .hh .v.RH = newkern ( fontinfo [ italicbase [ 
  535.       f ] + ( fontinfo [ charbase [ f ] + mem [ p ] .hh.b1 ] .qqqq .b2 ) / 4 ] 
  536.       .cint ) ; 
  537.       curlist .tailfield = mem [ curlist .tailfield ] .hh .v.RH ; 
  538.     } 
  539.     mem [ curlist .tailfield ] .hh.b1 = 1 ; 
  540.   } 
  541. void appenddiscretionary ( ) 
  542. {appenddiscretionary_regmem 
  543.   integer c  ; 
  544.   {
  545.     mem [ curlist .tailfield ] .hh .v.RH = newdisc () ; 
  546.     curlist .tailfield = mem [ curlist .tailfield ] .hh .v.RH ; 
  547.   } 
  548.   if ( curchr == 1 ) 
  549.   {
  550.     c = hyphenchar [ eqtb [ 4834 ] .hh .v.RH ] ; 
  551.     if ( c >= 0 ) 
  552.     if ( c < 256 ) 
  553.     mem [ curlist .tailfield + 1 ] .hh .v.LH = newcharacter ( eqtb [ 4834 ] 
  554.     .hh .v.RH , c ) ; 
  555.   } 
  556.   else {
  557.       
  558.     incr ( saveptr ) ; 
  559.     savestack [ saveptr - 1 ] .cint = 0 ; 
  560.     newsavelevel ( 10 ) ; 
  561.     scanleftbrace () ; 
  562.     pushnest () ; 
  563.     curlist .modefield = -102 ; 
  564.     curlist .auxfield .hh .v.LH = 1000 ; 
  565.   } 
  566. void builddiscretionary ( ) 
  567. {/* 30 10 */ builddiscretionary_regmem 
  568.   halfword p, q  ; 
  569.   integer n  ; 
  570.   unsave () ; 
  571.   q = curlist .headfield ; 
  572.   p = mem [ q ] .hh .v.RH ; 
  573.   n = 0 ; 
  574.   while ( p != 0 ) {
  575.       
  576.     if ( ! ( p >= himemmin ) ) 
  577.     if ( mem [ p ] .hh.b0 > 2 ) 
  578.     if ( mem [ p ] .hh.b0 != 11 ) 
  579.     if ( mem [ p ] .hh.b0 != 6 ) 
  580.     {
  581.       {
  582.     if ( interaction == 3 ) 
  583.     wakeupterminal () ; 
  584.     printnl ( 262 ) ; 
  585.     print ( 1100 ) ; 
  586.       } 
  587.       {
  588.     helpptr = 1 ; 
  589.     helpline [ 0 ] = 1101 ; 
  590.       } 
  591.       error () ; 
  592.       begindiagnostic () ; 
  593.       printnl ( 1102 ) ; 
  594.       showbox ( p ) ; 
  595.       enddiagnostic ( true ) ; 
  596.       flushnodelist ( p ) ; 
  597.       mem [ q ] .hh .v.RH = 0 ; 
  598.       goto lab30 ; 
  599.     } 
  600.     q = p ; 
  601.     p = mem [ q ] .hh .v.RH ; 
  602.     incr ( n ) ; 
  603.   } 
  604.   lab30: ; 
  605.   p = mem [ curlist .headfield ] .hh .v.RH ; 
  606.   popnest () ; 
  607.   switch ( savestack [ saveptr - 1 ] .cint ) 
  608.   {case 0 : 
  609.     mem [ curlist .tailfield + 1 ] .hh .v.LH = p ; 
  610.     break ; 
  611.   case 1 : 
  612.     mem [ curlist .tailfield + 1 ] .hh .v.RH = p ; 
  613.     break ; 
  614.   case 2 : 
  615.     {
  616.       if ( ( n > 0 ) && ( abs ( curlist .modefield ) == 203 ) ) 
  617.       {
  618.     {
  619.       if ( interaction == 3 ) 
  620.       wakeupterminal () ; 
  621.       printnl ( 262 ) ; 
  622.       print ( 1094 ) ; 
  623.     } 
  624.     printesc ( 346 ) ; 
  625.     {
  626.       helpptr = 2 ; 
  627.       helpline [ 1 ] = 1095 ; 
  628.       helpline [ 0 ] = 1096 ; 
  629.     } 
  630.     flushnodelist ( p ) ; 
  631.     n = 0 ; 
  632.     error () ; 
  633.       } 
  634.       else mem [ curlist .tailfield ] .hh .v.RH = p ; 
  635.       if ( n <= 255 ) 
  636.       mem [ curlist .tailfield ] .hh.b1 = n ; 
  637.       else {
  638.       
  639.     {
  640.       if ( interaction == 3 ) 
  641.       wakeupterminal () ; 
  642.       printnl ( 262 ) ; 
  643.       print ( 1097 ) ; 
  644.     } 
  645.     {
  646.       helpptr = 2 ; 
  647.       helpline [ 1 ] = 1098 ; 
  648.       helpline [ 0 ] = 1099 ; 
  649.     } 
  650.     error () ; 
  651.       } 
  652.       if ( n > 0 ) 
  653.       curlist .tailfield = q ; 
  654.       decr ( saveptr ) ; 
  655.       return ; 
  656.     } 
  657.     break ; 
  658.   } 
  659.   incr ( savestack [ saveptr - 1 ] .cint ) ; 
  660.   newsavelevel ( 10 ) ; 
  661.   scanleftbrace () ; 
  662.   pushnest () ; 
  663.   curlist .modefield = -102 ; 
  664.   curlist .auxfield .hh .v.LH = 1000 ; 
  665. void makeaccent ( ) 
  666. {makeaccent_regmem 
  667.   real s, t  ; 
  668.   halfword p, q, r  ; 
  669.   internalfontnumber f  ; 
  670.   scaled a, h, x, w, delta  ; 
  671.   fourquarters i  ; 
  672.   scancharnum () ; 
  673.   f = eqtb [ 4834 ] .hh .v.RH ; 
  674.   p = newcharacter ( f , curval ) ; 
  675.   if ( p != 0 ) 
  676.   {
  677.     x = fontinfo [ 5 + parambase [ f ] ] .cint ; 
  678.     s = fontinfo [ 1 + parambase [ f ] ] .cint / ((double) 65536.0 ) ; 
  679.     a = fontinfo [ widthbase [ f ] + fontinfo [ charbase [ f ] + mem [ p ] 
  680.     .hh.b1 ] .qqqq .b0 ] .cint ; 
  681.     doassignments () ; 
  682.     q = 0 ; 
  683.     f = eqtb [ 4834 ] .hh .v.RH ; 
  684.     if ( ( curcmd == 11 ) || ( curcmd == 12 ) || ( curcmd == 68 ) ) 
  685.     q = newcharacter ( f , curchr ) ; 
  686.     else if ( curcmd == 16 ) 
  687.     {
  688.       scancharnum () ; 
  689.       q = newcharacter ( f , curval ) ; 
  690.     } 
  691.     else backinput () ; 
  692.     if ( q != 0 ) 
  693.     {
  694.       t = fontinfo [ 1 + parambase [ f ] ] .cint / ((double) 65536.0 ) ; 
  695.       i = fontinfo [ charbase [ f ] + mem [ q ] .hh.b1 ] .qqqq ; 
  696.       w = fontinfo [ widthbase [ f ] + i .b0 ] .cint ; 
  697.       h = fontinfo [ heightbase [ f ] + ( i .b1 ) / 16 ] .cint ; 
  698.       if ( h != x ) 
  699.       {
  700.     p = hpack ( p , 0 , 1 ) ; 
  701.     mem [ p + 4 ] .cint = x - h ; 
  702.       } 
  703.       delta = round ( ( w - a ) / ((double) 2.0 ) + h * t - x * s ) ; 
  704.       r = newkern ( delta ) ; 
  705.       mem [ r ] .hh.b1 = 2 ; 
  706.       mem [ curlist .tailfield ] .hh .v.RH = r ; 
  707.       mem [ r ] .hh .v.RH = p ; 
  708.       curlist .tailfield = newkern ( - (integer) a - delta ) ; 
  709.       mem [ curlist .tailfield ] .hh.b1 = 2 ; 
  710.       mem [ p ] .hh .v.RH = curlist .tailfield ; 
  711.       p = q ; 
  712.     } 
  713.     mem [ curlist .tailfield ] .hh .v.RH = p ; 
  714.     curlist .tailfield = p ; 
  715.     curlist .auxfield .hh .v.LH = 1000 ; 
  716.   } 
  717. void alignerror ( ) 
  718. {alignerror_regmem 
  719.   if ( abs ( alignstate ) > 2 ) 
  720.   {
  721.     {
  722.       if ( interaction == 3 ) 
  723.       wakeupterminal () ; 
  724.       printnl ( 262 ) ; 
  725.       print ( 1107 ) ; 
  726.     } 
  727.     printcmdchr ( curcmd , curchr ) ; 
  728.     if ( curtok == 1062 ) 
  729.     {
  730.       {
  731.     helpptr = 6 ; 
  732.     helpline [ 5 ] = 1108 ; 
  733.     helpline [ 4 ] = 1109 ; 
  734.     helpline [ 3 ] = 1110 ; 
  735.     helpline [ 2 ] = 1111 ; 
  736.     helpline [ 1 ] = 1112 ; 
  737.     helpline [ 0 ] = 1113 ; 
  738.       } 
  739.     } 
  740.     else {
  741.     
  742.       {
  743.     helpptr = 5 ; 
  744.     helpline [ 4 ] = 1108 ; 
  745.     helpline [ 3 ] = 1114 ; 
  746.     helpline [ 2 ] = 1111 ; 
  747.     helpline [ 1 ] = 1112 ; 
  748.     helpline [ 0 ] = 1113 ; 
  749.       } 
  750.     } 
  751.     error () ; 
  752.   } 
  753.   else {
  754.       
  755.     backinput () ; 
  756.     if ( alignstate < 0 ) 
  757.     {
  758.       {
  759.     if ( interaction == 3 ) 
  760.     wakeupterminal () ; 
  761.     printnl ( 262 ) ; 
  762.     print ( 653 ) ; 
  763.       } 
  764.       incr ( alignstate ) ; 
  765.       curtok = 379 ; 
  766.     } 
  767.     else {
  768.     
  769.       {
  770.     if ( interaction == 3 ) 
  771.     wakeupterminal () ; 
  772.     printnl ( 262 ) ; 
  773.     print ( 1103 ) ; 
  774.       } 
  775.       decr ( alignstate ) ; 
  776.       curtok = 637 ; 
  777.     } 
  778.     {
  779.       helpptr = 3 ; 
  780.       helpline [ 2 ] = 1104 ; 
  781.       helpline [ 1 ] = 1105 ; 
  782.       helpline [ 0 ] = 1106 ; 
  783.     } 
  784.     inserror () ; 
  785.   } 
  786. void noalignerror ( ) 
  787. {noalignerror_regmem 
  788.   {
  789.     if ( interaction == 3 ) 
  790.     wakeupterminal () ; 
  791.     printnl ( 262 ) ; 
  792.     print ( 1107 ) ; 
  793.   } 
  794.   printesc ( 523 ) ; 
  795.   {
  796.     helpptr = 2 ; 
  797.     helpline [ 1 ] = 1115 ; 
  798.     helpline [ 0 ] = 1116 ; 
  799.   } 
  800.   error () ; 
  801. void omiterror ( ) 
  802. {omiterror_regmem 
  803.   {
  804.     if ( interaction == 3 ) 
  805.     wakeupterminal () ; 
  806.     printnl ( 262 ) ; 
  807.     print ( 1107 ) ; 
  808.   } 
  809.   printesc ( 526 ) ; 
  810.   {
  811.     helpptr = 2 ; 
  812.     helpline [ 1 ] = 1117 ; 
  813.     helpline [ 0 ] = 1116 ; 
  814.   } 
  815.   error () ; 
  816. void doendv ( ) 
  817. {doendv_regmem 
  818.   if ( curgroup == 6 ) 
  819.   {
  820.     endgraf () ; 
  821.     if ( fincol () ) 
  822.     finrow () ; 
  823.   } 
  824.   else offsave () ; 
  825. void cserror ( ) 
  826. {cserror_regmem 
  827.   {
  828.     if ( interaction == 3 ) 
  829.     wakeupterminal () ; 
  830.     printnl ( 262 ) ; 
  831.     print ( 772 ) ; 
  832.   } 
  833.   printesc ( 501 ) ; 
  834.   {
  835.     helpptr = 1 ; 
  836.     helpline [ 0 ] = 1119 ; 
  837.   } 
  838.   error () ; 
  839. void zpushmath ( c ) 
  840. groupcode c ; 
  841. {pushmath_regmem 
  842.   pushnest () ; 
  843.   curlist .modefield = -203 ; 
  844.   curlist .auxfield .cint = 0 ; 
  845.   newsavelevel ( c ) ; 
  846. void initmath ( ) 
  847. {/* 21 40 45 30 */ initmath_regmem 
  848.   scaled w  ; 
  849.   scaled l  ; 
  850.   scaled s  ; 
  851.   halfword p  ; 
  852.   halfword q  ; 
  853.   internalfontnumber f  ; 
  854.   integer n  ; 
  855.   scaled v  ; 
  856.   scaled d  ; 
  857.   gettoken () ; 
  858.   if ( ( curcmd == 3 ) && ( curlist .modefield > 0 ) ) 
  859.   {
  860.     if ( curlist .headfield == curlist .tailfield ) 
  861.     {
  862.       popnest () ; 
  863.       w = -1073741823L ; 
  864.     } 
  865.     else {
  866.     
  867.       linebreak ( eqtb [ 6170 ] .cint ) ; 
  868.       v = mem [ justbox + 4 ] .cint + 2 * fontinfo [ 6 + parambase [ eqtb [ 
  869.       4834 ] .hh .v.RH ] ] .cint ; 
  870.       w = -1073741823L ; 
  871.       p = mem [ justbox + 5 ] .hh .v.RH ; 
  872.       while ( p != 0 ) {
  873.       
  874.     lab21: if ( ( p >= himemmin ) ) 
  875.     {
  876.       f = mem [ p ] .hh.b0 ; 
  877.       d = fontinfo [ widthbase [ f ] + fontinfo [ charbase [ f ] + mem [ p 
  878.       ] .hh.b1 ] .qqqq .b0 ] .cint ; 
  879.       goto lab40 ; 
  880.     } 
  881.     switch ( mem [ p ] .hh.b0 ) 
  882.     {case 0 : 
  883.     case 1 : 
  884.     case 2 : 
  885.       {
  886.         d = mem [ p + 1 ] .cint ; 
  887.         goto lab40 ; 
  888.       } 
  889.       break ; 
  890.     case 6 : 
  891.       {
  892.         mem [ memtop - 12 ] = mem [ p + 1 ] ; 
  893.         mem [ memtop - 12 ] .hh .v.RH = mem [ p ] .hh .v.RH ; 
  894.         p = memtop - 12 ; 
  895.         goto lab21 ; 
  896.       } 
  897.       break ; 
  898.     case 11 : 
  899.     case 9 : 
  900.       d = mem [ p + 1 ] .cint ; 
  901.       break ; 
  902.     case 10 : 
  903.       {
  904.         q = mem [ p + 1 ] .hh .v.LH ; 
  905.         d = mem [ q + 1 ] .cint ; 
  906.         if ( mem [ justbox + 5 ] .hh.b0 == 1 ) 
  907.         {
  908.           if ( ( mem [ justbox + 5 ] .hh.b1 == mem [ q ] .hh.b0 ) && ( mem 
  909.           [ q + 2 ] .cint != 0 ) ) 
  910.           v = 1073741823L ; 
  911.         } 
  912.         else if ( mem [ justbox + 5 ] .hh.b0 == 2 ) 
  913.         {
  914.           if ( ( mem [ justbox + 5 ] .hh.b1 == mem [ q ] .hh.b1 ) && ( mem 
  915.           [ q + 3 ] .cint != 0 ) ) 
  916.           v = 1073741823L ; 
  917.         } 
  918.         if ( mem [ p ] .hh.b1 >= 100 ) 
  919.         goto lab40 ; 
  920.       } 
  921.       break ; 
  922.     case 8 : 
  923.       d = 0 ; 
  924.       break ; 
  925.       default: 
  926.       d = 0 ; 
  927.       break ; 
  928.     } 
  929.     if ( v < 1073741823L ) 
  930.     v = v + d ; 
  931.     goto lab45 ; 
  932.     lab40: if ( v < 1073741823L ) 
  933.     {
  934.       v = v + d ; 
  935.       w = v ; 
  936.     } 
  937.     else {
  938.         
  939.       w = 1073741823L ; 
  940.       goto lab30 ; 
  941.     } 
  942.     lab45: p = mem [ p ] .hh .v.RH ; 
  943.       } 
  944.       lab30: ; 
  945.     } 
  946.     if ( eqtb [ 4312 ] .hh .v.RH == 0 ) 
  947.     if ( ( eqtb [ 6747 ] .cint != 0 ) && ( ( ( eqtb [ 6204 ] .cint >= 0 ) && ( 
  948.     curlist .pgfield + 2 > eqtb [ 6204 ] .cint ) ) || ( curlist .pgfield + 1 < 
  949.     - (integer) eqtb [ 6204 ] .cint ) ) ) 
  950.     {
  951.       l = eqtb [ 6733 ] .cint - abs ( eqtb [ 6747 ] .cint ) ; 
  952.       if ( eqtb [ 6747 ] .cint > 0 ) 
  953.       s = eqtb [ 6747 ] .cint ; 
  954.       else s = 0 ; 
  955.     } 
  956.     else {
  957.     
  958.       l = eqtb [ 6733 ] .cint ; 
  959.       s = 0 ; 
  960.     } 
  961.     else {
  962.     
  963.       n = mem [ eqtb [ 4312 ] .hh .v.RH ] .hh .v.LH ; 
  964.       if ( curlist .pgfield + 2 >= n ) 
  965.       p = eqtb [ 4312 ] .hh .v.RH + 2 * n ; 
  966.       else p = eqtb [ 4312 ] .hh .v.RH + 2 * ( curlist .pgfield + 2 ) ; 
  967.       s = mem [ p - 1 ] .cint ; 
  968.       l = mem [ p ] .cint ; 
  969.     } 
  970.     pushmath ( 15 ) ; 
  971.     curlist .modefield = 203 ; 
  972.     eqworddefine ( 6207 , -1 ) ; 
  973.     eqworddefine ( 6743 , w ) ; 
  974.     eqworddefine ( 6744 , l ) ; 
  975.     eqworddefine ( 6745 , s ) ; 
  976.     if ( eqtb [ 4316 ] .hh .v.RH != 0 ) 
  977.     begintokenlist ( eqtb [ 4316 ] .hh .v.RH , 9 ) ; 
  978.     if ( nestptr == 1 ) 
  979.     buildpage () ; 
  980.   } 
  981.   else {
  982.       
  983.     backinput () ; 
  984.     {
  985.       pushmath ( 15 ) ; 
  986.       eqworddefine ( 6207 , -1 ) ; 
  987.       if ( eqtb [ 4315 ] .hh .v.RH != 0 ) 
  988.       begintokenlist ( eqtb [ 4315 ] .hh .v.RH , 8 ) ; 
  989.     } 
  990.   } 
  991.